package cn.tedu.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;

public class Test3_2 {
    public static void main(String[] args) {
        ArrayList<Integer> list =new ArrayList<>();
        Collections.addAll(list,1,2,2,3,5,8,4,6,2,7,9,2);
        ArrayList<Integer> list2=new ArrayList<>();
        for (Integer date:list2) {
            if(!list2.contains(date)){
                list2.add(date);
            }
        }
        System.out.println(list2);
        ArrayList<Integer> list1 =new ArrayList<>();
        Collections.addAll(list1,2,5,6,9,7,45,2,8);
        HashSet<Integer> set =new HashSet<>();
        for (Integer date:list1) {
            set.add(date);
        }
        System.out.println(set);
    }
}
